namespace Digitalmes.Domain.Entities.Mes.Reworks;

/// <summary>
/// 产品返工过程明细数据。
/// </summary>
[SugarTable("rework_detail_data")]
public sealed class ReworkDetailData : EntityBase
{
    /// <summary>
    /// 关联的返工过程明细 Id。
    /// </summary>
    public long ReworkDetailId { get; set; }

    /// <summary>
    /// 顺序索引，没有默认为 0。
    /// </summary>
    public int Index { get; set; }

    /// <summary>
    /// 参数名称
    /// </summary>
    [NotNull]
    public string? ParamName { get; set; } = string.Empty;

    /// <summary>
    /// 参数编码
    /// </summary>
    [NotNull]
    public string? ParamCode { get; set; } = string.Empty;

    /// <summary>
    /// 值，null 表示结果不带值。
    /// </summary>
    public double? Value { get; set; }

    /// <summary>
    /// 偏差
    /// </summary>
    public string? Tolerance { get; set; }

    /// <summary>
    /// 标准值下限
    /// </summary>
    public double? MinLimit { get; set; }

    /// <summary>
    /// 标准值上限
    /// </summary>
    public double? MaxLimit { get; set; }

    /// <summary>
    /// 单位
    /// </summary>
    public string? Unit { get; set; }

    /// <summary>
    /// 判定结果（OK/NG），默认为空。
    /// </summary>
    [NotNull]
    public string? Result { get; set; } = string.Empty;

    /// <summary>
    /// 创建时间
    /// </summary>
    /// <remarks>用于分表使用。</remarks>
    [SplitField]
    public DateTime CreateTime { get; set; } = DateTime.Now;
}
